package com.coderitl.springmvc.controller;

import com.coderitl.springmvc.dao.BookInfoDao;
import com.coderitl.springmvc.service.BookInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
@RequestMapping("/book")
public class BookInfoController {
    @Autowired
    private BookInfoService service;

    /**
     * 返回 json 数据
     *
     * @return
     */
    @ResponseBody
    @RequestMapping("/showbook.do")
    public List<BookInfoDao> showAllBookInfoS() {
        ModelAndView mv = new ModelAndView();
        List<BookInfoDao> showAllBookRes = service.showAllBook();
        return showAllBookRes;
    }
}
